BackItemDetailPanel = function() {
	var this_panel = this;

	
	this.listeners = {
			show : function(){
				this_panel.getTopToolbar().init();
			}
		};
	var store =  new Ext.data.GroupingStore({
		url : "item/findAll.action",
		reader : itemReader,
		groupField:'person.name'
	});
	
    var expander = new Ext.ux.grid.RowExpander({
        tpl : new Ext.Template(
        		'<p><b>售价:</b> {sellPrice}</p>',
                '<p><b>进价:</b> {buyPrice}</p>',
                '<p><b>货品数量:</b> {count}</p>',
                '<p><b>货品单位:</b> {unit}</p>'
        )
    });
	
    BackItemDetailPanel.superclass.constructor.call(this, {
		title : "回款奖励明细表",
		loadMask : true,
		plugins: expander,
		enableHdMenu : false,
		sm: new Ext.grid.RowSelectionModel({singleSelect:true}),
		autoExpandColumn : "product",
	    view: new Ext.grid.GroupingView({
	    	hideGroupedColumn : true,
	    	startCollapsed : true,
            groupTextTpl: '{text} ({[values.rs.length]}个项目)'
        }),
		colModel: new Ext.grid.ColumnModel({
			defaults : {
				align : "center",
				width : 70
			},
			columns : [expander,
			    {header : "医院名称",dataIndex : "hospital.name",align : "left",width : 140}, 
			    {header : "货品名称",dataIndex : "product.name",align : "left",id : "product"}, 
			    {header : "销售人员",dataIndex : "person.name"},
			    {header : "收款日期",dataIndex : "backDate",width : 80},
			    {header : "发货日期",dataIndex : "sellDate",width : 80},
			    {header : "超期"    ,dataIndex : "outDay",renderer : outDayRender,width : 50},
			    {header : "回款金额",dataIndex : "sellSum"},
			    {header : "顺加比例",dataIndex : "shunjia",format : "0.00%",xtype : "numbercolumn"}, 
			    {header : "提成比例",dataIndex : "proportion",format : "0.00%",xtype : "numbercolumn"},
			    {header : "提成合计",dataIndex : "sum",xtype:"numbercolumn", format:"0"}, 
			    {header : "业务经理",dataIndex : "businessman",xtype:"numbercolumn", format:"0"}, 
			    {header : "技术支持",dataIndex : "techSupport",xtype:"numbercolumn", format:"0"}, 
			    {header : "部门经理",dataIndex : "manager",xtype:"numbercolumn", format:"0"}, 
			    {header : "团队"    ,dataIndex : "team",xtype:"numbercolumn", format:"0"}]
		 }),
		store :store,
		tbar : new SeasonToolbar({
			panel : this_panel,
			url : "item/findAllBySeason.action",
			type : "back"
		})
	});
};
Ext.extend(BackItemDetailPanel, Ext.grid.GridPanel);
var backItemDetailPanel = new BackItemDetailPanel();